<form class="form-horizontal" id="registerHere" method='POST' action='?page=balas&action=balas'>
  <fieldset>
	<legend>BALAS KOMENTAR</legend>
	<?php
	
	   if (isset($_GET['success']) && ($_GET['success'] == "1")) {

			$o .= '<div class="alert alert-success">
					Balas komentar berhasil
					</div>';
					
		} elseif (isset($_GET['success']) && ($_GET['success'] == "0")) {
			
			$o .= '<div class="alert alert-error">
					Balas komentar gagal
				   </div>';
		}
		
	echo $o;
	
	?>
	
<div class="control-group">
	<label class="control-label" for="input01">Isi Pesan</label>
	  <div class="controls">
	  <textarea name="pesan" class="input-xlarge" rows="5" cols="35"></textarea>
	  </div>
</div>

<div class="control-group">
	<label class="control-label" for="input01"></label>
	  <div class="controls">
	   <button type="submit" class="btn btn-success">Balas</button>
	  </div>
</div>
  </fieldset>
</form>

<a href="?page=bukutamu">kembali</a>

<?php


if ($_GET['action'] == "balas") {
	
	$nama 		= $_SESSION['nama'];
	$username	= $_SESSION['username'];
	$email		= $_SESSION['email'];
	$isi		= $_POST['pesan'];
	
	$db = new BukuTamu();
	$balaskomentar = array ('nama'=>$nama, 
							'username'=>$username, 
							'email'=>$email,
							'isi_bukutamu'=> $isi);

	$balas = $db->tambah("bukutamu", $balaskomentar);
	if ($balas) {
		?>
		<script language="javascript">
		document.location="?page=balas&success=1";
		</script>
		<?php
	
	} else {
		?>
			<script language="javascript">
			document.location="?page=balas&success=0";
			</script>
		<?php
	}
	
}





